<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport"
			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.css" rel="stylesheet" />
		<style type="text/css">
			.mui-preview-image.mui-fullscreen {
				position: fixed;
				z-index: 20;
				background-color: #000;
			}

			.mui-preview-header,
			.mui-preview-footer {
				position: absolute;
				width: 100%;
				left: 0;
				z-index: 10;
			}

			.mui-preview-header {
				height: 44px;
				top: 0;
			}

			.mui-preview-footer {
				height: 50px;
				bottom: 0px;
			}

			.mui-preview-header .mui-preview-indicator {
				display: none;
			}

			.mui-preview-image {
				display: none;
				-webkit-animation-duration: 0.5s;
				animation-duration: 0.5s;
				-webkit-animation-fill-mode: both;
				animation-fill-mode: both;
			}

			.mui-preview-image.mui-preview-in {
				-webkit-animation-name: fadeIn;
				animation-name: fadeIn;
			}

			.mui-preview-image.mui-preview-out {
				background: none;
				-webkit-animation-name: fadeOut;
				animation-name: fadeOut;
			}

			.mui-preview-image.mui-preview-out .mui-preview-header,
			.mui-preview-image.mui-preview-out .mui-preview-footer {
				display: none;
			}

			.mui-zoom-scroller {
				position: absolute;
				display: -webkit-box;
				display: -webkit-flex;
				display: flex;
				-webkit-box-align: center;
				-webkit-align-items: center;
				align-items: center;
				-webkit-box-pack: center;
				-webkit-justify-content: center;
				justify-content: center;
				left: 0;
				right: 0;
				bottom: 0;
				top: 0;
				width: 100%;
				height: 100%;
				margin: 0;
				-webkit-backface-visibility: hidden;
			}

			.mui-zoom {
				-webkit-transform-style: preserve-3d;
				transform-style: preserve-3d;
			}

			.mui-slider .mui-slider-group .mui-slider-item img {
				width: auto;
				height: auto;
				max-width: 100%;
				max-height: 100%;
			}

			.mui-android-4-1 .mui-slider .mui-slider-group .mui-slider-item img {
				width: 100%;
			}

			.mui-android-4-1 .mui-slider.mui-preview-image .mui-slider-group .mui-slider-item {
				display: inline-table;
			}

			.mui-android-4-1 .mui-slider.mui-preview-image .mui-zoom-scroller img {
				display: table-cell;
				vertical-align: middle;
			}

			.mui-preview-loading {
				position: absolute;
				width: 100%;
				height: 100%;
				top: 0;
				left: 0;
				display: none;
			}

			.mui-preview-loading.mui-active {
				display: block;
			}

			.mui-preview-loading .mui-spinner-white {
				position: absolute;
				top: 50%;
				left: 50%;
				margin-left: -25px;
				margin-top: -25px;
				height: 50px;
				width: 50px;
			}

			.mui-preview-image img.mui-transitioning {
				-webkit-transition: -webkit-transform 0.5s ease, opacity 0.5s ease;
				transition: transform 0.5s ease, opacity 0.5s ease;
			}

			@-webkit-keyframes fadeIn {
				0% {
					opacity: 0;
				}

				100% {
					opacity: 1;
				}
			}

			@keyframes fadeIn {
				0% {
					opacity: 0;
				}

				100% {
					opacity: 1;
				}
			}

			@-webkit-keyframes fadeOut {
				0% {
					opacity: 1;
				}

				100% {
					opacity: 0;
				}
			}

			@keyframes fadeOut {
				0% {
					opacity: 1;
				}

				100% {
					opacity: 0;
				}
			}

			p img {
				max-width: 100%;
				height: auto;
			}
		</style>
	</head>

	<body style="background-color: #EAEAEA;">
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		</header>
		<div class="mui-content" style="background-color: #EAEAEA;">
			<div style="padding: 10px 0 0 10px; height: 100px; background-color: white;">
				<img id="face" src='photo.jpg' width="60px" height="60px" style="border-radius: 5px;"
					class="mui-pull-left" data-preview-src="" data-preview-group="1">
				<div class="mui-pull-left" style="margin-left: 20px;">
					<div id="name" style="font-size: 20px; font-weight: 600;">爱新觉罗·L</div>
					<div id="id_txt" style="color: gray; font-size: 14px; line-height: 14px; margin: 10px 0 0 0;">
						微信号：123456</div>
					<div style="color: gray; font-size: 14px; line-height: 14px; margin: 10px 0 0 0;">地区：浙江 杭州</div>
				</div>
			</div>

			<div id="send_request"
				style="display: none; margin-top: 10px; color: #222288; width: 100%; text-align: center; height: 50px; line-height: 50px; font-size: 16px; font-weight: 700; background-color: white;">
				添加到通讯录
			</div>

			<div id="send-message"
				style="display: none; height: 50px; text-align: center; line-height: 50px; margin-top: 10px; background-color: white;">
				发消息</div>
			<div id="video-chat"
				style="display: none; height: 50px; text-align: center; line-height: 50px; margin-top: 1px; background-color: white;">
				音视频通话</div>
		</div>
		<script src="js/mui.js"></script>
		<script src="js/app.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/mui.zoom.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/mui.previewimage.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			mui.previewImage();
			mui.init();

			mui.plusReady(function() {
				var self = plus.webview.currentWebview();
				var u = self.u;

				var ele_face = document.getElementById('face');
				ele_face.src = app.getFaceImage(u.id);
				ele_face.setAttribute('data-preview-src',
					app.getFaceThumbnailUrl(u.id, 300, 300));

				var name_txt = document.getElementById("name");
				name_txt.innerHTML = u.name;

				var id_txt = document.getElementById("id_txt");
				id_txt.innerHTML = "微信号: " + u.id;

				var ele_send_request = document.getElementById("send_request");
				var ele_send_message = document.getElementById("send-message");
				var ele_video_chat = document.getElementById("video-chat");

				if (app.getFriendItem(u.id) != null ||
					u.id == app.getGlobalUserInfo().id) {
					ele_send_message.style.display = "block";
					ele_video_chat.style.display = "block";
				} else {
					send_request.style.display = "block";
				}

				ele_send_request.addEventListener("tap", function() {
					var userInfo = app.getGlobalUserInfo();
					mui.ajax(app.serverAddress + "/u/raf", {
						data: {
							id1: userInfo.id,
							id2: u.id
						},
						dataType: 'jsonp',
						jsonp: "callback",
						type: 'post',
						timeout: 10000,
						headers: {
							'Content-Type': 'application/json'
						},
						success: function(data) {
							mui.toast("已发送");
						},
						error: function(xhr, type, errorThrown) {

						}
					});
				});

				ele_send_message.addEventListener("tap", function() {
					mui.openWindow({
						url: "chatting.html",
						extras: {
							friendUserId: u.id
						}
					});
				});

				ele_video_chat.addEventListener('tap', function() {
					mui.openWindow('video_chatting.html');
				});

			})
		</script>
	</body>

</html>
